import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import 'default-passive-events'
/**
 * npm i default-passive-events -S
 * 解决-----[Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event.
 * import 'default-passive-events'
 */

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n
import locale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control

Vue.$httpRequestList = []

/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */
// if (process.env.NODE_ENV === 'production') {
//   const { mockXHR } = require('../mock')
//   mockXHR()
// }

// set ElementUI lang to EN
Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
Vue.use(ElementUI)

Vue.prototype.$pinyin = require('js-pinyin')

Vue.prototype.$project_config = require('@/settings.js')

import getuid from '@/sun-components/uuid.js'
Vue.prototype.$uuid = getuid

import VueClipboard from 'vue-clipboard2'
Vue.use(VueClipboard)

import onFinishBox from '@/sun-components/SunMsg.js'
Vue.prototype.$onFinishBox = onFinishBox

import onValidator from '@/validator.js'
import { validateField } from '@/validator.js'
Vue.prototype.$validateField = validateField
Vue.prototype.$onValidator = onValidator

import Print from 'vue-print-nb'
Vue.use(Print)

// import { EdgeSight } from '@/performanceMonitor.js'
// Vue.prototype.$SunEdgeSight = EdgeSight

import { $getHtmlContent, $getTeacherHtml } from '@/sun-components/SunHtmlContent.js'
Vue.prototype.$SunCustomHtml = $getHtmlContent
Vue.prototype.$SunTeacherHtml = $getTeacherHtml

import { $setBtn, $setDelBtn } from '@/sun-components/SunBtn.js'
Vue.prototype.$sunSetBtn = $setBtn
Vue.prototype.$setDelBtn = $setDelBtn

import xhrDownload from '@/sun-components/SunXhrDownload.js'
Vue.prototype.$XhrDownload = xhrDownload

import { $setRenderHeader } from '@/sun-components/SunProcessRenderHeader.js'
Vue.prototype.$SunRenderHeader = $setRenderHeader

import { ctFormData, initFormData, submitInformation, setAccept, unique, getAuditComment } from '@/sun-components/SunInformationFun.js'
Vue.prototype.$SunCtFormData = ctFormData
Vue.prototype.$SunInitFormData = initFormData
Vue.prototype.$SunSubmitInformation = submitInformation
Vue.prototype.$SunSetAccept = setAccept
Vue.prototype.$SunUnique = unique
Vue.prototype.$SunGetAuditComment = getAuditComment

import SunNetworkHint from '@/sun-components/SunNetworkHint'
Vue.component('sunNetworkHint', SunNetworkHint)

import SunPerformanceMonitor from '@/sun-components/SunPerformanceMonitor'
Vue.component('sunPerformanceMonitor', SunPerformanceMonitor)

import { tableHeader, tableTotalWidth, tableRowWidth, tableColumnLine } from '@/sun-process-common/table-column.js'
Vue.prototype.$tableHeader = tableHeader
Vue.prototype.$tableTotalWidth = tableTotalWidth
Vue.prototype.$tableRowWidth = tableRowWidth
Vue.prototype.$tableColumnLine = tableColumnLine

import VueXgplayer from 'vue-xgplayer'
Vue.use(VueXgplayer, { // http://v2.h5player.bytedance.com/config/#%E6%B5%81%E5%BC%8F%E5%B8%83%E5%B1%80 播放配置
  width: document.documentElement.clientWidth > 1800 ? 1100 : '',
  pip: true, // 画中画
  fluid: document.documentElement.clientWidth <= 1800,
  videoInit: true, // 初始化显示视频首帧
  autoplay: true, // 自动播放
  // ignores: [{ 'loading': 'http://www.ynxunlu.com.cn/logo.png' }],
  playbackRate: [0.5, 0.75, 1, 1.5, 2] // 传入倍速可选数组
})

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
